/*This do-file replicates results presented in Christian A. Vossler and Ewa Zawojska, 
"Behvavioral drivers or economic incentives? Toward a better understanding of elicitation effects in stated preference studies", 
Journal of the Association of Environmental and Resource Economists */

*For questions, contact Christian Vossler (cvossler@utk.edu)
*The name of the public use data file is "VZ data (public).dta"

***Table 1: Summary Statistics by Treatment
sum Age Female EarnedIncome Employed GPA Comprehension Confusion NeedInformation Certainty if SBC==1
sum Age Female EarnedIncome Employed GPA Comprehension Confusion NeedInformation Certainty if DB==1
sum Age Female EarnedIncome Employed GPA Comprehension Confusion NeedInformation Certainty if PC==1
sum Age Female EarnedIncome Employed GPA Comprehension Confusion NeedInformation Certainty if OE==1

***Various tests based on Table 1 data
ttest Age if PC==1 | SBC==1, by(PC)
ttest Age if PC==1 | OE==1, by(PC)
ttest Age if PC==1 | DB==1, by(PC)
ttest Age if SBC==1 | OE==1, by(SBC)
ttest Age if SBC==1 | DB==1, by(SBC)
ttest Age if OE==1 | DB==1, by(OE)

tabulate Female PC if PC==1 | SBC==1, exact
tabulate Female PC if PC==1 | OE==1, exact
tabulate Female PC if PC==1 | DB==1, exact
tabulate Female SBC if SBC==1 | OE==1, exact
tabulate Female SBC if SBC==1 | DB==1, exact
tabulate Female OE if OE==1 | DB==1, exact

tabulate Employed PC if PC==1 | SBC==1, exact
tabulate Employed PC if PC==1 | OE==1, exact
tabulate Employed PC if PC==1 | DB==1, exact
tabulate Employed SBC if SBC==1 | OE==1, exact
tabulate Employed SBC if SBC==1 | DB==1, exact
tabulate Employed OE if OE==1 | DB==1, exact

tabulate GPA PC if PC==1 | SBC==1, exact
tabulate GPA PC if PC==1 | OE==1, exact
tabulate GPA PC if PC==1 | DB==1, exact
tabulate GPA SBC if SBC==1 | OE==1, exact
tabulate GPA SBC if SBC==1 | DB==1, exact
tabulate GPA OE if OE==1 | DB==1, exact

ttest Comprehension if PC==1 | SBC==1, by(PC)
ttest Comprehension if PC==1 | OE==1, by(PC)
ttest Comprehension if PC==1 | DB==1, by(PC)
ttest Comprehension if SBC==1 | OE==1, by(SBC)
ttest Comprehension if SBC==1 | DB==1, by(SBC)
ttest Comprehension if OE==1 | DB==1, by(OE)

ttest Confusion if PC==1 | SBC==1, by(PC)
ttest Confusion if PC==1 | OE==1, by(PC)
ttest Confusion if PC==1 | DB==1, by(PC)
ttest Confusion if SBC==1 | OE==1, by(SBC)
ttest Confusion if SBC==1 | DB==1, by(SBC)
ttest Confusion if OE==1 | DB==1, by(OE)

ttest NeedInformation if PC==1 | SBC==1, by(PC)
ttest NeedInformation if PC==1 | OE==1, by(PC)
ttest NeedInformation if PC==1 | DB==1, by(PC)
ttest NeedInformation if SBC==1 | OE==1, by(SBC)
ttest NeedInformation if SBC==1 | DB==1, by(SBC)
ttest NeedInformation if OE==1 | DB==1, by(OE)

ttest Certainty if PC==1 | SBC==1, by(PC)
ttest Certainty if PC==1 | OE==1, by(PC)
ttest Certainty if PC==1 | DB==1, by(PC)
ttest Certainty if SBC==1 | OE==1, by(SBC)
ttest Certainty if SBC==1 | DB==1, by(SBC)
ttest Certainty if OE==1 | DB==1, by(OE)


***Table 2: Empirical Survival Functions – Percentage of “Yes” Votes by Cost 
tab CostSBC ChoiceSBC if SBC==1, row nofreq
sum ChoiceDB_1-ChoiceDB_6 if DB==1
sum ChoicePC0-ChoicePC10 if PC==1
sum OE1-OE10 if OE==1


***Table 3, Model I: interval regression, equal variances, no controls
intreg LB UB DB PC OE
// Tests of treatment effects
test OE=DB
test OE=PC
test DB=PC
test OE=DB=PC=0
// Treatment-specific WTP estimates
lincom _cons + DB // WTP in DB treatment
lincom _cons + PC // WTP in PC treatment
lincom _cons + OE // WTP in OE treatment


***Table 3, Model II: interval regression, allow for different variances, no controls
intreg LB UB DB PC OE, het(DB PC OE)
// Tests of treatment effects
test OE=DB=PC=0
test OE=DB
test OE=PC
test DB=PC
// Treatment-specific WTP estimates
lincom _cons + DB // WTP in DB treatment
lincom _cons + PC // WTP in PC treatment
lincom _cons + OE // WTP in OE treatment
// convert ln(std dev) into std dev
nlcom exp([lnsigma]_cons+[lnsigma]DB) - exp([lnsigma]_cons) // STD DEV of WTP for DB (relative to SBC)
nlcom exp([lnsigma]_cons+[lnsigma]PC) - exp([lnsigma]_cons) // STD DEV of WTP for PC (relative to SBC)
nlcom exp([lnsigma]_cons+[lnsigma]OE) - exp([lnsigma]_cons) // STD DEV of WTP for OE (relative to SBC)
nlcom exp([lnsigma]_cons) // STD DEV of WTP for SBC


***Table 3, Model III: interval regression, allow for different variances, include controls
intreg LB UB DB PC OE Age_demean Female_demean EarnedIncome_demean Employed_demean GPA_demean PriorExperiment_demean, het(DB PC OE)
// Tests of treatment effects
test OE=DB=PC=0
test OE=DB 
test OE=PC
test DB=PC
// Treatment-specific WTP estimates
lincom _cons + DB // WTP in DB treatment
lincom _cons + PC // WTP in PC treatment
lincom _cons + OE // WTP in OE treatment
// convert ln(std dev) into std dev
nlcom exp([lnsigma]_cons+[lnsigma]DB) - exp([lnsigma]_cons) // STD DEV of WTP for DB (relative to SBC)
nlcom exp([lnsigma]_cons+[lnsigma]PC) - exp([lnsigma]_cons) // STD DEV of WTP for PC (relative to SBC)
nlcom exp([lnsigma]_cons+[lnsigma]OE) - exp([lnsigma]_cons) // STD DEV of WTP for OE (relative to SBC)
nlcom exp([lnsigma]_cons) // STD DEV of WTP for SBC


***Bivariate interval regression for DB data 
biprobit (ChoiceDB1 = CostDB1) (ChoiceDB2 = CostDB2)
nlcom -[ChoiceDB1]_cons/[ChoiceDB1]CostDB1 // Mean WTP1
nlcom -[ChoiceDB2]_cons/[ChoiceDB2]CostDB2 // Mean WTP2
nlcom -1/[ChoiceDB1]CostDB1 // SD WTP1
nlcom -1/[ChoiceDB2]CostDB2 // SD WTP2
testnl (-1/[ChoiceDB2]CostDB2 = -1/[ChoiceDB1]CostDB1) (-[ChoiceDB2]_cons/[ChoiceDB2]CostDB2 =  -[ChoiceDB1]_cons/[ChoiceDB1]CostDB1) // Test: equal means and SDs
